﻿using System.ComponentModel.DataAnnotations;
using Microsoft.AspNetCore.Mvc;
using PayService.Filter;

namespace PayService.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    [ValidModel]
    public class FilterController : ControllerBase
    {
        [HttpPost]
        [ValidModel]
        public IActionResult ValidModel([FromBody]FilterModel filterModel)
        {
            return new JsonResult(filterModel);
        }
    }

    public class FilterModel
    {
        [Required(ErrorMessage = "必填项！")]
        [Range(0, long.MaxValue, ErrorMessage = "大于等于零！")]
        public long? Num { get; set; }

        public string Test { get; set; }
    }
}